<template>
<div>
    <div class="box-table">
        <el-table :data="tableData.list" tooltip-effect="dark" @selection-change="handleSelected">
            <el-table-column align="center" type="selection" width="55"></el-table-column>
            <el-table-column align="center" prop="name" label="表名" show-overflow-tooltip>
                <template slot-scope="scope">
                    <el-button @click="jump(scope.row)" type="text">{{scope.row.name}}</el-button>
                </template>
            </el-table-column>
            <el-table-column align="center" prop="name" label="状态" show-overflow-tooltip></el-table-column>
            <el-table-column align="center" prop="name" label="字段数" show-overflow-tooltip></el-table-column>
            <el-table-column align="center" prop="name" label="大小" show-overflow-tooltip>
                <template slot-scope="scope">{{ scope.row.date }}</template>
            </el-table-column>
             <el-table-column align="center" prop="name" label="创建时间" show-overflow-tooltip></el-table-column>
            <el-table-column align="center" label="创建人">
                <template slot-scope="scope">
                    <el-button @click="$emit('add', false, scope.row)" type="text">进入机器学习</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <div class="box-pagenation">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="tableData.currentPage" :page-size="tableData.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total">
        </el-pagination>
    </div>
</div>
</template>

<script>
export default {
    name: 'DataHomeList',
    props: {
        tableData: {
            type: Object,
            required: true
        }
    },
    data () {
        return {
            selected: []
        }
    },
    methods: {
        handleCurrentChange (val) {
            this.tableData.currentPage = val
            this.$emit('flash')
        },
        handleSizeChange (val) {
            this.tableData.pageSize = val
            this.$emit('flash')
        },
        handleSelected (val) {
            this.selected = val
        },
        jump (item) {
            this.$router.push({
                path: '/data/check',
                query: {
                    id: item.id
                }
            })
        }
    }
}
</script>

<style>
   .box-table table th, .box-table table tbody td {
       height: 42px;
       font-size: 14px;
       box-sizing: border-box !important;
   }
   .box-table table th {
       color: #464D5F;
       height: 48px;
   }
</style>
